package solution;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

public class AdjacencyListDiGraphTest {
    @Test
    @DisplayName("测试有向图的邻接列表实现：构建有向图")
    public void testCreateDigraph(){
        //0: [1, 5]
        //1: []
        //2: [0, 3]
        //3: [2, 5]
        //4: [2, 3]
        //5: [4]
        //6: [0, 4, 9]
        //7: [6, 8]
        //8: [7, 9]
        //9: [10, 11]
        //10: [12]
        //11: [4, 12]
        //12: [9]
        Graph<Integer> digraph = new AdjacencyListDigraph<>();
        digraph.addEdge(0, 1);
        digraph.addEdge(0, 5);
        digraph.addEdge(2, 0);
        digraph.addEdge(2, 3);
        digraph.addEdge(3, 2);
        digraph.addEdge(3, 5);
        digraph.addEdge(4, 2);
        digraph.addEdge(4, 3);
        digraph.addEdge(5, 4);
        digraph.addEdge(6, 0);
        digraph.addEdge(6, 4);
        digraph.addEdge(6, 9);
        digraph.addEdge(7, 6);
        digraph.addEdge(7, 8);
        digraph.addEdge(8, 7);
        digraph.addEdge(8, 9);
        digraph.addEdge(9, 10);
        digraph.addEdge(9, 11);
        digraph.addEdge(10, 12);
        digraph.addEdge(11, 4);
        digraph.addEdge(11, 12);
        digraph.addEdge(12, 9);

        digraph.addVertex(1);

    }
}
